home *** CD-ROM | disk | FTP | other *** search
/ PC World 2006 December / PCWorld_2006-12_cd.bin / v cisle / aster / asterie.exe / asterie.frm (.txt) < prev    next >
Visual Basic Form  |  2004-10-22  |  6KB  |  138 lines

  1. VERSION 5.00
  2. Begin VB.Form frmMain 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "AsterWin IE"
  5.    ClientHeight    =   4620
  6.    ClientLeft      =   1275
  7.    ClientTop       =   1725
  8.    ClientWidth     =   6135
  9.    Icon            =   "asterie.frx":0000
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   4620
  14.    ScaleWidth      =   6135
  15.    Begin VB.CommandButton cmdPasswords 
  16.       Caption         =   "Show Internet Explorer Passwords"
  17.       Height          =   495
  18.       Left            =   120
  19.       TabIndex        =   1
  20.       Top             =   3960
  21.       Width           =   2775
  22.    End
  23.    Begin VB.TextBox txtPasswords 
  24.       Height          =   3735
  25.       Left            =   120
  26.       Locked          =   -1  'True
  27.       MultiLine       =   -1  'True
  28.       ScrollBars      =   3  'Both
  29.       TabIndex        =   0
  30.       Top             =   120
  31.       Width           =   5775
  32.    End
  33. Attribute VB_Name = "frmMain"
  34. Attribute VB_GlobalNameSpace = False
  35. Attribute VB_Creatable = False
  36. Attribute VB_PredeclaredId = True
  37. Attribute VB_Exposed = False
  38. Option Explicit
  39. 'AsterWin IE v1.03
  40. 'Copyright 
  41.  2002 - 2004 Nir Sofer
  42. 'Web site: http://www.nirsoft.net
  43. 'This utility reveals the passwords behind the asterisks in the Internet Explorer windows. (version 5.x and above only)
  44. 'It scans all opened Internet Explorer windows on your system, and reveals the passwords behind the asterisks in all password-boxes that appears in the web pages.
  45. 'License:
  46. 'This utility is released as freeware.
  47. 'You are allowed to freely distribute this utility via floppy disk, CD-ROM,
  48. 'Internet, or in any other way, as long as you don't charge anything for this.
  49. 'If you distribute this utility, you must include all files in the distribution
  50. 'package including the source code, without any modification !
  51. 'You are not allowed to combine this utility with a commercial product in any way !
  52. Private strCurrTitle            As String
  53. 'This function checks if we can access the Document object without errors.
  54. Private Function CanAccessDocumentObject(Obj As Object) As Boolean
  55.     Dim oDocument       As Object
  56.     On Error GoTo err1:
  57.     Set oDocument = Obj.document
  58.     Set oDocument = Nothing
  59.     CanAccessDocumentObject = True
  60.     Exit Function
  61. err1:
  62.     CanAccessDocumentObject = False
  63. End Function
  64. Private Function IsPasswordBox(objElement As Object) As Boolean
  65.     On Error GoTo err1
  66.     If LCase(objElement.getAttribute("Type")) = "password" Then
  67.         IsPasswordBox = True
  68.     Else
  69.         IsPasswordBox = False
  70.     End If
  71.     Exit Function
  72. err1:
  73.     IsPasswordBox = False
  74. End Function
  75. Private Function SearchPasswordsInDoc(objDoc As Object) As Boolean
  76.     Dim objElement      As Object
  77.     Dim lngLen          As Long
  78.     Dim lngIndex        As Long
  79.     Dim blnFound        As Boolean
  80.     'Get the number of elements in the document.
  81.     lngLen = objDoc.All.length
  82.     'Enumerates all elements in the document, in order to find the password elements.
  83.     For Each objElement In objDoc.All
  84.         DoEvents
  85.         'Checks if the element is a password-box.
  86.         If IsPasswordBox(objElement) Then
  87.             'We found a password-box, so we reveal it together with window title.
  88.             txtPasswords.Text = txtPasswords.Text & "Window Title: " & strCurrTitle & vbCrLf
  89.             txtPasswords.Text = txtPasswords.Text & "Password: " & objElement.getAttribute("Value") & vbCrLf & vbCrLf
  90.             blnFound = True
  91.         End If
  92.     Next
  93.     lngLen = objDoc.frames.length
  94.     'Enumerates all frames in the document
  95.     For lngIndex = 0 To lngLen - 1
  96.         'First, check if we can access the document object without receiving any error:
  97.         If CanAccessDocumentObject(objDoc.frames.Item(lngIndex)) Then
  98.             'If the document contains one or more frames, search for a password also in them:
  99.             If SearchPasswordsInDoc(objDoc.frames.Item(lngIndex).document) Then blnFound = True
  100.         End If
  101.     Next
  102.     SearchPasswordsInDoc = blnFound
  103. End Function
  104. Private Sub ScanPasswords()
  105.     Dim objShellWins    As New SHDocVw.ShellWindows
  106.     Dim objExplorer     As SHDocVw.InternetExplorer
  107.     Dim objDocument     As HTMLDocument
  108.     Dim blnFound        As Boolean
  109.     Dim blnResult       As Boolean
  110.     txtPasswords = "Scanning all windows, please wait..." & vbCrLf & vbCrLf
  111.     Screen.MousePointer = vbHourglass
  112.     'Enumerates All IE windows.
  113.     For Each objExplorer In objShellWins
  114.         If TypeOf objExplorer.document Is HTMLDocument Then
  115.             Set objDocument = objExplorer.document
  116.             'Saves the current title for using it if a password-box is found.
  117.             strCurrTitle = objDocument.Title
  118.             'Search for password-boxes in the document, including all frames in it.
  119.             blnResult = SearchPasswordsInDoc(objDocument)
  120.             If blnResult Then blnFound = True
  121.         End If
  122.     Next
  123.     If Not blnFound Then
  124.         txtPasswords.Text = txtPasswords.Text & "Password(s) not found." & vbCrLf
  125.     Else
  126.         txtPasswords.Text = txtPasswords.Text & "Done !" & vbCrLf
  127.     End If
  128.     Screen.MousePointer = vbDefault
  129. End Sub
  130. Private Sub cmdPasswords_Click()
  131.     On Error GoTo err1
  132.     ScanPasswords
  133.     Exit Sub
  134. err1:
  135.     Screen.MousePointer = vbDefault
  136.     MsgBox "Error " & CStr(Err.Number) & ": " & Err.Description, vbOKOnly Or vbExclamation, ""
  137. End Sub
  138.